/*
 * geomobject.h
 *
 *      Author: Jerome RD Soine and Christoph A Brand
 *      Institution: Schwarz goup, Institute for Theoretical Physics, Heidelberg University, Germany
 */

#ifndef GEOMOBJECT_H
#define GEOMOBJECT_H

#include "base/vertex.h"
#include "base/edge.h"
#include "base/triangle.h"

#include <vector>

class FileManager;
class ColorDataExtractor;
class FixedPointsExtractor;

class GeomObject {

private:
	;
protected:
	vector<Vertex*> vertices;
	vector<Triangle*> triangles;
	vector<Edge*> edges;
	Vertex center;

	void init(string filename, string snapshotPath, Vertex CENTER, bool clear);
	void orientNormals();
	void indexVertices();
	void removeVerticesWithoutConnection();

	FileManager * fm;
	GeomObject() {};

public:
	GeomObject(string filename, string snapshotPath, Vertex center);
	GeomObject(string filename, string snapshotPath, Vertex center, bool clear);
	~GeomObject();
	void saveSnapshot();
	void saveVTK(string filename);
	void saveWireframe(string filename);
	void printStatus();

	vector<Vertex*>* getVertices() { return &vertices; };
	vector<Triangle*>* getTriangles() { return &triangles; };
	vector<Edge*>* getEdges() { return &edges; };

	void setVertices(vector<Vertex*> v) { vertices = v; };
	void setEdges(vector<Edge*> e) { edges = e; };
	void setTriangles(vector<Triangle*> t) { triangles = t; };

	Vertex getCenter() { return center; };

	void moveVerticesBy(vector<double> & shift);
	void moveVerticesBackBy(vector<double> & shift);
	double area();
	double volume();

	void fixFirstVertices(int number);
	void setColorDataExtractor(ColorDataExtractor * cde);
	void setFixedPointsExtractor(FixedPointsExtractor * cde);
};

#endif // GEOMOBJECT_H
